from DrissionPage import ChromiumPage, ChromiumOptions

# 设置浏览器的路径并且保存设置
ChromiumOptions().set_browser_path(
    r"C:\Program Files\Google\Chrome\Application\chrome.exe"
).save()
"""
<body>
  <div id="one">
    <p class="p_cls" name="row1">第一行</p>
    <p class="p_cls" name="row2">第二行</p>
    <p class="p_cls">第三行</p>
  </div>
  <div id="two">
    第二个div
  </div>
</body>
"""
page = ChromiumPage()
page.get("https://static.docs-hub.com/ysczdjbyf_1750214922342.html")

div1 = page.ele("#one")
print(div1)
# 属性选择
p1 = page.ele("@name=row1")
print(p1)
# 文本选择器
div2 = page.ele("第二个div")
print(div2)
# 标签选择器
div1 = page.ele("#one")
p_list = div1.eles("tag:p")
print(p_list)
# 获取 div1后面的下一个元素
div2 = div1.next()
print(div2)
